<template>
  <div class="container">
    <div class="main">
      <img src="../../../static/logo_background.gif" style="width: 130px;margin-top: 50px;">
      <div>
        <!-- <p style="font-size: 28px;font-weight: bolder;">学生科技服务与管理平台</p> -->
        <div class="titlenn">
          <div style="font-size: 32px;color:#042d7e;font-weight:bolderfont-family:STKaiTi;margin-top: 15px;margin-left:10px">校园智谷</div>
          <div style="font-size: 20px;color:#865168;font-family:STLiti;margin-top: 5px;">SCIE</div>
        </div>
        <p style="font-size:14px;font-family:FZYaoti;">campus intelligent valley</p>
        <p style="font-size: 20px;padding-top: 20px">用户登录</p>
      </div>
      <el-input class="userinput" prefix-icon="el-icon-user" placeholder="用户账号" v-model="username"></el-input>
      <el-input class="userinput" prefix-icon="el-icon-lock" placeholder="用户密码" type="password" v-model="password" style="margin-top: 10px"></el-input>
      <el-button class="userinput" @click="goBack" type="primary" style="margin-top: 20px">登录</el-button>
      <br>
      <div style="width: 80%;padding-left: 10%">
        <span class="footButtonBg" style="text-align: left"><a class="footButton" @click="goBack" >注册</a></span>

      </div>
      <div class="footer">

      </div>
    </div>
  </div>
</template>

<script scoped>
  import router from "../../router";
  import {
    //adminRouterMap,
  } from "../../router";

  export default {
    name: "myLogin",
    data() {
      return {
        username: '',
        password: '',
      };
    },
    methods: {
      goBack() {
        if(this.username == "123" && this.password == "123"){
          this.$router.push("/main/statistic");
        }
      },
      toAdmin() {
        this.$router.push("/admin_login");
      },
      goNext() {
        var jsonObject=new URLSearchParams()
        let i={
          password:this.password,
          username:this.username
        }
        let e=JSON.stringify(i)
        jsonObject.append("jsonObject",e)
        this.axios
        .post("/web/j/loginBean.adminLogin.rpc",jsonObject,
          {
            headers:{
              'Content-Type':'application/x-www-form-urlencoded'
            }
          }).then((response) => {
            if (response.data.code == 0) {
              //在浏览器中存放token、user_id、role用于后续调用
              sessionStorage.setItem("Token", response.data.data.Token);
              router.addRoutes(adminRouterMap);
              this.$router.push('/');
            } else {
              this.$message.error("用户名或密码错误");
              this.username = "";
              this.password = "";
            }
          });
      },
    },
    created() {
    },
  };
</script>
<style scoped lang="scss">
  .container {
    background: url("../../static/background.jpg") no-repeat;
    background-size: cover;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    height: 100%;
  }
  .main {
    margin:0 auto;
    background: rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 460px;
    height: 100%;
  }

  .footButtonBg{
    float:left;
    width:49%;
    padding-top: 1%;
    font-size: 14px;
    color: white;
    text-shadow: 0px 0px 3px #000;
  }

  .footButton:hover{
    cursor: pointer;
  }

  .userinput {
    min-width: 360px;
    max-width: 360px;
    height: 40px;
  }

  .footer {
    position: absolute;
    bottom: 5%;
    color: white;
    font-size: 12px;
    width: 460px;
    text-shadow: 0px 0px 3px #000;
  }
  //上面为新的
.titlenn{
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }
</style>
